< previous page
page_974
next page >
Page 974
10. Use the context menu again on the DBGrid and select Edit. Resize the columns as needed.
11. Set the BoundColumn property of the data-bound list control to PubID. Blank out the DataField and DataSource properties.
12. Enter the following code in the
DBList1_click
event:
Private Sub DBList1_Click()
Dim cFind As String
cFind = "PubID=" + Trim(DBList1.BoundText)
Data2.Recordset.FindFirst cFind
End Sub
13. Enter the following code in the
Data2_Reposition
event:
Private Sub Data2_Reposition()
Dim cSQL As String
cSQL = "Select * from Titles WHERE PubID=" + Trim(Text1(0))
Data3.RecordSource = cSQL ' filter the data set
Data3.Refresh ' refresh the data control
DBGrid1.ReBind ' refresh the data grid
End Sub
14. Save and execute your program.
Day 13
Answers to Day 13 Quiz
1. These are the benefits of using SQL to create and manage data tables:
·
SQL statements can serve as documentation for your table layouts.
·
It's easy to produce test or sample data tables with SQL statements.
·
You can easily load test data into new tables with SQL statements.
·
You can utilize SQL for multiple data platforms.
2. The syntax is
CREATE TABLE TableName (Field1 TYPE(SIZE), Field2 TYPE(SIZE), _);
You first enter
CREATE TABLE
, followed by the name of the table, and then the fields in parentheses. The field types and sizes (sizes apply to TEXT columns only) are entered after each field.
< previous page
page_974
next page >
If you like this book, buy it!